﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Chatters.aspx.cs" Inherits="WebChat.Admin.Chatters" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView runat="server" ID="GridViewChatters" DataSourceID="EntityDataSourceChatters"
            AutoGenerateEditButton="true"            
            AutoGenerateColumns="false"
            DataKeyNames="ChatterId" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:HyperLink runat="server" 
                            Text="delete"
                            NavigateUrl='<%# "~/Admin/ConfirmDelete.aspx?chatterId=" + Eval("ChatterId") %>'  />
                </ItemTemplate>                
            </asp:TemplateField>
            
            <asp:TemplateField HeaderText="Username" >
                <ItemTemplate>
                    <asp:HyperLink runat="server" 
                            Text='<%# EvalUserName() %>' 
                            NavigateUrl='<%# "~/User/Chatter.aspx?chatterId=" + Eval("ChatterId") %>'  />
                </ItemTemplate>                
            </asp:TemplateField>

            <asp:TemplateField HeaderText="First Name" SortExpression="FirstName">
                <ItemTemplate>
                    <asp:Label runat="server" Text='<%# SafeEval("FirstName") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="TextBoxFirstName" Text='<%# Bind("FirstName") %>' />
                    <asp:RequiredFieldValidator  runat="server" ControlToValidate="TextBoxFirstName" >*</asp:RequiredFieldValidator> 
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Last Name" SortExpression="LastName">
                <ItemTemplate>
                    <asp:Label runat="server" Text='<%# SafeEval("LastName") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="TextBoxLastName" Text='<%# Bind("LastName") %>' />
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="TextBoxLastName" >*</asp:RequiredFieldValidator> 
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSourceChatters" runat="server" 
                ConnectionString="name=WebChatLocalEntities" 
                DefaultContainerName="WebChatLocalEntities"             
                EntitySetName="Chatters"     
                EnableUpdate="True"                
                EnableFlattening="False" >                                                   
        </asp:EntityDataSource>
</asp:Content>
